package com.cp.sms.util;

import lombok.Data;
import lombok.Setter;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author ming
 * @create 2022/7/29
 * @description:
 */
@Data
@Component
@ConfigurationProperties(prefix = "aliyun.sms")
public class SmsProperties implements InitializingBean {
    private String  regionId;
    private String keyId;
    private String keySecret;
    private String templateCode;
    private String signName;
    public static  String REGION_ID;
    public static  String KEY_ID;
    public static  String KEY_SECRET;
    public static  String TEMPLATE_CODE;
    public static  String SIGN_NAME;

    @Override
    //Spring 自动赋值后调用的方法
    public void afterPropertiesSet() throws Exception {
        REGION_ID = regionId;
        KEY_ID = keyId;
        KEY_SECRET = keySecret;
        TEMPLATE_CODE = templateCode;
        SIGN_NAME = signName;

    }
}
